<!DOCTYPE html>
<html>
<head><meta name="generator" content="Hexo 3.8.0">
  <meta charset="utf-8">
  

  
  <title>mysql | DIBA HOME</title>
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  <meta name="description" content="what型语言：SQL三种类型12345数据操作语言：DML is Data Manipulation Language statements.  SQL中处理数据等操作统称为数据操纵语言 增删改查数据定义语言：DDL is Data Definition Language statements.  用于定义和管理SQL 数据库中的所有对象的语言            (建设者的角度,建表,建库,">
<meta property="og:type" content="article">
<meta property="og:title" content="mysql">
<meta property="og:url" content="http://yoursite.com/2018/04/27/mysql/index.html">
<meta property="og:site_name" content="DIBA HOME">
<meta property="og:description" content="what型语言：SQL三种类型12345数据操作语言：DML is Data Manipulation Language statements.  SQL中处理数据等操作统称为数据操纵语言 增删改查数据定义语言：DDL is Data Definition Language statements.  用于定义和管理SQL 数据库中的所有对象的语言            (建设者的角度,建表,建库,">
<meta property="og:locale" content="default">
<meta property="og:updated_time" content="2018-05-09T06:46:45.164Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="mysql">
<meta name="twitter:description" content="what型语言：SQL三种类型12345数据操作语言：DML is Data Manipulation Language statements.  SQL中处理数据等操作统称为数据操纵语言 增删改查数据定义语言：DDL is Data Definition Language statements.  用于定义和管理SQL 数据库中的所有对象的语言            (建设者的角度,建表,建库,">
  
    <link rel="alternate" href="/atom.xml" title="DIBA HOME" type="application/atom+xml">
  
  
    <link rel="icon" href="/favicon.png">
  
  
    <link href="//fonts.googleapis.com/css?family=Source+Code+Pro" rel="stylesheet" type="text/css">
  
  <link rel="stylesheet" href="/css/style.css">
</head>
</html>
<body>
  <div id="container">
    <div id="wrap">
      <header id="header">
  <div id="banner"></div>
  <div id="header-outer" class="outer">
    <div id="header-title" class="inner">
      <h1 id="logo-wrap">
        <a href="/" id="logo">DIBA HOME</a>
      </h1>
      
    </div>
    <div id="header-inner" class="inner">
      <nav id="main-nav">
        <a id="main-nav-toggle" class="nav-icon"></a>
        
          <a class="main-nav-link" href="/">Home</a>
        
          <a class="main-nav-link" href="/archives">Archives</a>
        
      </nav>
      <nav id="sub-nav">
        
          <a id="nav-rss-link" class="nav-icon" href="/atom.xml" title="RSS Feed"></a>
        
        <a id="nav-search-btn" class="nav-icon" title="Search"></a>
      </nav>
      <div id="search-form-wrap">
        <form action="//google.com/search" method="get" accept-charset="UTF-8" class="search-form"><input type="search" name="q" class="search-form-input" placeholder="Search"><button type="submit" class="search-form-submit">&#xF002;</button><input type="hidden" name="sitesearch" value="http://yoursite.com"></form>
      </div>
    </div>
  </div>
</header>
      <div class="outer">
        <section id="main"><article id="post-mysql" class="article article-type-post" itemscope="" itemprop="blogPost">
  <div class="article-meta">
    <a href="/2018/04/27/mysql/" class="article-date">
  <time datetime="2018-04-27T10:06:24.000Z" itemprop="datePublished">2018-04-27</time>
</a>
    
  </div>
  <div class="article-inner">
    
    
      <header class="article-header">
        
  
    <h1 class="article-title" itemprop="name">
      mysql
    </h1>
  

      </header>
    
    <div class="article-entry" itemprop="articleBody">
      
        <h2 id="what型语言：SQL三种类型"><a href="#what型语言：SQL三种类型" class="headerlink" title="what型语言：SQL三种类型"></a>what型语言：SQL三种类型</h2><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line">数据操作语言：DML is Data Manipulation Language statements.  SQL中处理数据等操作统称为数据操纵语言 增删改查</span><br><span class="line">数据定义语言：DDL is Data Definition Language statements.  用于定义和管理SQL 数据库中的所有对象的语言</span><br><span class="line">            (建设者的角度,建表,建库,建视图 等等, 15%)</span><br><span class="line">数据控制语言: DCL is Data Control Language statements.  用来授予或回收访问数据库的某种特权，并控制数据库操纵事务发生的时间及效果，</span><br><span class="line">            对数据库实行监视等(管理员角度,DBA[数据库管理员],5%) 这个用户是否有权限建表,等</span><br></pre></td></tr></table></figure>
<h2 id="子查询"><a href="#子查询" class="headerlink" title="子查询"></a>子查询</h2><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">where型子查询：select goods_id,goods_name from goods where goods_id=(select max(goods_id) from goods);</span><br><span class="line">from型子查询：select goods_id,goods_name,cat_id from (select goods_id,cat_id,goods_name from goods</span><br><span class="line">            order by cat_id asc,goods_id desc) as tmp group by cat_id</span><br><span class="line">exist型子查询：select * from category where exists (select * from goods where category.cat_id=goods.cat_id);</span><br></pre></td></tr></table></figure>
<h2 id="dd"><a href="#dd" class="headerlink" title="dd"></a>dd</h2>
      
    </div>
    <footer class="article-footer">
      <a data-url="http://yoursite.com/2018/04/27/mysql/" data-id="cjppdoc1j00037gadhdmz5hmu" class="article-share-link">Share</a>
      
      
    </footer>
  </div>
  
    
<nav id="article-nav">
  
  
    <a href="/2017/08/18/git-hexo-command/" id="article-nav-older" class="article-nav-link-wrap">
      <strong class="article-nav-caption">Older</strong>
      <div class="article-nav-title">git+hexo命令</div>
    </a>
  
</nav>

  
</article>

</section>
        
          <aside id="sidebar">
  
    

  
    

  
    
  
    
  <div class="widget-wrap">
    <h3 class="widget-title">Archives</h3>
    <div class="widget">
      <ul class="archive-list"><li class="archive-list-item"><a class="archive-list-link" href="/archives/2018/04/">April 2018</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2017/08/">August 2017</a></li></ul>
    </div>
  </div>


  
    
  <div class="widget-wrap">
    <h3 class="widget-title">Recent Posts</h3>
    <div class="widget">
      <ul>
        
          <li>
            <a href="/2018/04/27/mysql/">mysql</a>
          </li>
        
          <li>
            <a href="/2017/08/18/git-hexo-command/">git+hexo命令</a>
          </li>
        
          <li>
            <a href="/2017/08/17/diba/">HEXO FIRST DAY</a>
          </li>
        
          <li>
            <a href="/2017/08/17/hello-world/">Hello World</a>
          </li>
        
      </ul>
    </div>
  </div>

  
</aside>
        
      </div>
      <footer id="footer">
  
  <div class="outer">
    <div id="footer-info" class="inner">
      &copy; 2018 Diba Li<br>
      Powered by <a href="http://hexo.io/" target="_blank">Hexo</a>
    </div>
  </div>
</footer>
    </div>
    <nav id="mobile-nav">
  
    <a href="/" class="mobile-nav-link">Home</a>
  
    <a href="/archives" class="mobile-nav-link">Archives</a>
  
</nav>
    

<script src="//ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script>


  <link rel="stylesheet" href="/fancybox/jquery.fancybox.css">
  <script src="/fancybox/jquery.fancybox.pack.js"></script>


<script src="/js/script.js"></script>



  </div>
</body>
</html>